<script>
export default {
	globalData: {
        isIos: false,
        platformStatus: 1,
        statusBarHeight: 20,
        //小程序配置的接口请求域名，为项目部署的服务器路径
        apiBaseUri: "http://www.example.com/api",
        //小程序appi
        appid: '',
        //前端上传图片补全域名，如oss的https://example.oss-cn-shanghai.aliyuncs.com，或https://www.example.com
        storageBaseUri: "",
        //阿里OSS的上传路径
        uploadOssStatus: false,
        alioss: {endpoint:''},
	},
	onLaunch: function() {
		let app = this;
		uni.getSystemInfo({
			success: res => {
                if(res.platform == 'ios' || res.platform == 'mac'){
                    app.globalData.isIos = true;
                }
				if (res.statusBarHeight < 20) {
					app.globalData.statusBarHeight = 20;
					return;
				}
				app.globalData.statusBarHeight = res.statusBarHeight;
			}
		});
		app.$core.onRequestComplete(function (ret, response) {
			if(ret && ret.code===401) {
				if(app.$user.getUserinfo()) {
				  app.$user.logout();
				  uni.reLaunch({url: '/pages/login/login'});
				  uni.showToast({title: '登录过期,请重新登录',icon:'none'});
				}
		   }
		      
		});
		setTimeout(function () {
			  // app初始化完成后再执行
			  //#ifdef MP-WEIXIN
			   app.$user.wxLogin();
			  //#endif
		},1);
	},
	onShow: function() {
	    let app = this;
        //支付开关
        app.$core.get({
            url: 'xiluedu.config/config',
            data: {name:'shopinfo'},
            success: ret => {
                //if(ret.data.vip_status != 'undefined'){
                app.globalData.platformStatus = ret.data.vip_status || 1;
                console.log(app.globalData.platformStatus)
                //}
            },
            loading: false
        });
	},
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style>
/*每个页面公共css */
@import url('/static/css/global.css');
</style>
